package com.sanjiahantang.youjiarole.module.common.views.impl;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.sanjiahantang.youjiarole.R;
import com.sanjiahantang.youjiarole.base.BaseMvpActivity;
import com.sanjiahantang.youjiarole.config.SPConfig;
import com.sanjiahantang.youjiarole.module.common.presenters.SettingsPresenter;
import com.sanjiahantang.youjiarole.module.common.views.SettingsView;
import com.sanjiahantang.youjiarole.utils.SPUtils;

/**
 * Created by zy on 2017/8/8.
 */

public class SettingsActivity extends BaseMvpActivity<SettingsView,SettingsPresenter> implements View.OnClickListener,SettingsView {

     View  rlWuL;
    @Override
    public SettingsPresenter initPresenter() {
        return new SettingsPresenter();
    }

    @Override
    public void initView() {
        setContentView(R.layout.activity_settings);
        TextView title = (TextView) findViewById(R.id.title);
        title.setText("设置");

        findViewById(R.id.myInfo).setOnClickListener(this);
        findViewById(R.id.addressManage).setOnClickListener(this);
        findViewById(R.id.changePWD).setOnClickListener(this);
        findViewById(R.id.changePayPWD).setOnClickListener(this);
        findViewById(R.id.txtLogout).setOnClickListener(this);
        findViewById(R.id.fl_Left).setOnClickListener(this);
        rlWuL=findViewById(R.id.wuLiao_Manage);
        rlWuL.setOnClickListener(this);
    }

    @Override
    public void initData() {
        String a= (String) SPUtils.get($this, SPConfig.ROLE_ID, "");
        if (a.contains("3")){
            rlWuL.setVisibility(View.VISIBLE);
        }else{
            rlWuL.setVisibility(View.GONE);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.myInfo:
                presenter.goMyInfo(this);
                break;
            case R.id.addressManage:
                presenter.goAddressManage(this);
                break;
            case R.id.changePWD:
                presenter.goChangePSD(this);
                break;
            case R.id.changePayPWD:
                presenter.goChangePayPSD(this);
                break;
            case R.id.wuLiao_Manage:
                presenter.goWuLiaoManager(this);
                break;
            case R.id.txtLogout:
                presenter.logout(this);
                break;
            case R.id.fl_Left:
                Intent intent=new Intent(this,MainActivity.class);
                intent.putExtra("First","True");
                startActivity(intent);
                finish();
                break;
        }
    }

    @Override
    public void showProgress() {
        super.showProgress(this);
    }
}
